package thread;

/**
 * 获取线程相关信息的一组方法
 */
public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread t = Thread.currentThread();
        String name = t.getName();
        long id = t.getId();
        System.out.println("name:" + name);
        System.out.println("id:" + id);

        int priority = t.getPriority();
        System.out.println("优先级：" + priority);

        boolean isAlive = t.isAlive();
        boolean isDaemon = t.isDaemon();
        boolean isInterrupted = t.isInterrupted();
        System.out.println("isAlive:" + isAlive);
        System.out.println("isDaemon:" + isDaemon);
        System.out.println("isInterrupted:" + isInterrupted);
    }
}
